import React from 'react';
import ReactDOM from 'react-dom'
import { BrowserRouter, Route, Switch, Link,HashRouter,Redirect } from 'react-router-dom'
import { createStore,applyMiddleware } from 'redux'
import { Provider } from 'react-redux'
import thunk from 'redux-thunk'
import logger from 'redux-logger'

import reduxor from './redux'

import './index.css'
import TMNavigator from './component/navigator/navigator';
import { menu, content } from './component/navigator/data'
import HxRoll from './component/hxroll/hxroll';
import { data as hxdata } from './component/hxroll/data'

const store = createStore(reduxor, applyMiddleware(thunk, logger))

function App () {
    return (
        <Provider store={store}>
        <BrowserRouter>
            <div>
                <Switch>
                    {/* 天猫首页商品分类导航 */}
                    <Route path="/h5/navigator" component={()=><TMNavigator menu={menu} content={content} />} />
                    {/* 红袖添香首页滚动 */}
                    <Route path="/h5/hxroll" component={()=><HxRoll data={hxdata} />} />
                    <Redirect to="/h5/hxroll" />
                </Switch>
            </div>
        </BrowserRouter>
        </Provider>
    )
}

ReactDOM.render(<App/>, document.getElementById('root'))